package org.dant.ant.extension.net.rmi;

import java.io.File;
import java.net.URL;
import java.rmi.Naming;

import org.dant.ant.extension.net.RemoteHelper;
import org.dant.ant.extension.tasks.internal.RemoteCommand;
import org.dant.ant.extension.tasks.internal.RemoteResponse;
import org.dant.ant.extension.tasks.internal.Endpoint;
import org.dant.ant.extension.net.NetConstants;

public class RMIHelper implements RemoteHelper {
  DistributedAnt impl = null;

  public RemoteResponse invoke(Endpoint destHost, RemoteCommand rCmd) throws Exception {
    impl = (DistributedAnt) Naming.lookup(destHost.getFullURL());
    return impl.remoteCall(rCmd);
  }

  public String getProtocol() {
    return NetConstants.DEFAULT_PROTOCOL;
  }

  public String getPath() {
    return NetConstants.DEFAULT_PATH;
  }
  
}
